<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style type="text/css">
        div#box{
            width: 100px;
            height: 100px;
            color: darkgray;
        }
        .red{
            background-color: red;
        }
        .blue{
            background-color: blue;
        }

    </style>
</head>
<body>
    <div id="app">
        <button @click="iscolor=!iscolor">点我切换</button>

        <div id="box" :class="{red:iscolor , blue:!iscolor}" >
            我是盒子
        </div>
    <h1>您的生日是:{{birth}}</h1>
    </div>


    <script src="../node_modules/vue/dist/vue.js"></script>
    <script type="text/javascript" >
        let vm = new Vue({
            el:'#app',
            data:{
                iscolor:true,
                birthday:1529032123201 // 毫秒值
            },
            computed:{
                birth(){
                    const d = new Date(this.birthday);
                    return d.getFullYear()+"-"+d.getMonth()+"-"+d.getDay()
                }
            }
        });
    </script>
</body>
</html>